package main.Q2001_2100;

public class Q2071_2080 {
    public static void main(String[] args) {
        System.out.println("Question2071：");
        System.out.println("Question2072：");
        System.out.println("Question2073：");
        System.out.println("Question2074：");
        System.out.println("Question2075：");
        System.out.println("Question2076：");
        System.out.println("Question2077：");
        System.out.println("Question2078：");
        System.out.println("Question2079：给植物浇水");
        System.out.println("Question2080：");
    }
}

class Question2079 {
    public int wateringPlants(int[] plants, int capacity) {
        int result = 0, curCapacity = capacity;
        for (int i = 0; i < plants.length; i++) {
            if (plants[i] <= curCapacity) {//当前水量足够
                result++;
                curCapacity -= plants[i];
            } else {//当前水量不足
                result += 2 * i + 1;
                curCapacity = capacity;//取水
                curCapacity -= plants[i];
            }
        }
        return result;
    }
}